home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Description:
- // Functions called from "Subdiv to NURBS conversion".
- //
-
- //
- // Procedure Name:
- // doSubdivToNurbs
- //
- // Description:
- // This is the actual function that gets called from "Subdiv to NURBS"
- // option box.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- // Note:
- //
- global proc int doSubdivToNurbs( string $args[] )
- {
- int $status = 0;
-
- if( size($args) < 1 ) {
- error("Incorrect doSubdivToNurbs \"1\" number of arguments.");
- return $status;
- }
-
- global int $gSelectSubdivSurface;
-
- // convert all subd's
- string $list[] = `filterExpand -ex 1 -fp 1 -sm $gSelectSubdivSurface`;
- int $len = size($list);
-
- if ($len == 0) {
- error ("Select a subdivision surface " +
- "which you want to convert.");
- return $status;
- }
-
- int $globalHist = $args[0];
- int $origObjectAction = $args[1];
- int $outputType = $args[2];
-
- string $cmd = "subdToNurbs";
-
- switch ($origObjectAction) {
- case 1:
- // replace original object, forces history off, but delete
- // will take care of that...
- $cmd = $cmd + " -ch off -aut on ";
- break;
-
- case 2:
- // hide original object, forces history on
- $cmd = $cmd + " -ch on -aut on ";
- if( !$globalHist ) {
- warning( "Forcing construction history to on." );
- }
- break;
-
- case 3:
- default:
- // show original object, respects global construction history
- $cmd = $cmd + " -ch " + $globalHist + " -aut on";
- break;
- }
-
- // output type
- $cmd = $cmd + " -ot " + $outputType + " ";
-
- // Convert each subdiv, one at a time so we can catch errors
- //
- string $nurbsRes[];
- string $selList = "";
-
- for($i = 0; $i < $len; $i++) {
- int $vis = `getAttr ($list[$i] + ".visibility")`;
- if (!$vis) continue;
- $retVal = catch ($nurbsRes = evalEcho ($cmd + $list[$i]));
-
- // if there's no error, do post work and add results
- if ($retVal != 1){
- switch ($origObjectAction){
- case 1:
- evalEcho ("delete " + $list[$i]);
- break;
- case 2:
- evalEcho ("hide " + $list[$i]);
- break;
- default:
- break;
- }
-
- for ($s in $nurbsRes) {
- $selList += ($s + " ");
- }
- }
- }
-
- if (size($selList) > 0){
- $selList += ";";
- eval ("select -r " + $selList);
- }
-
- return $status;
- }
-
-
-